<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<lv-select [lvOptions]="hostOptions" [lvValueKey]='lvValueKey' [(ngModel)]='value'
    (ngModelChange)='selectChange($event)' lvShowFilter lvShowCheckAll lvFilterKey='label'  [lvShowClear]="lvShowClear" lvFilterMode='contains'
    [lvContentTemplate]="contentTpl" [lvDisabled]='disabled' [lvMode]="mode" class="ng-invalid"
    [lvPlaceholder]="placeholder">
</lv-select>
<ng-template #contentTpl let-item>
    <lv-group lvGutter="4px" *ngIf="!isSimple">
        <i *ngIf="item.linkStatus || item.environment?.linkStatus" lv-icon="{{ isOnline(item) ?
                 'aui-host-online' : 'aui-host-offline'}}"></i>
        <span lv-overflow class="label-class">{{ item.label }}</span>
        <span class="aui-text-help-sm" style="vertical-align: middle;"
            *ngIf="item.extendInfo?.scenario || item.environment?.extendInfo?.scenario">
            {{isHostBuiltIn(item) ? hostBuiltinLabel : hostExternalLabel}}
        </span>
        <span class="guide-recommend-label" *ngIf="showGuideNew(item)">
            {{newResourceLabel}}
        </span>
    </lv-group>
    <lv-group class="simple-version" *ngIf="isSimple">
        <lv-group lvGutter="4px">
            <span>{{ item.label }}</span>
            <span class="guide-recommend-label" *ngIf="showGuideNew(item)">
                {{newResourceLabel}}
            </span>
        </lv-group>
        <aui-status [value]="item.linkStatus" type="resource_LinkStatus_Special"></aui-status>
    </lv-group>
</ng-template>